<?php
global $Config;
require_once($Config->WebCMSRoot.'Base/Control.php');
require_once($Config->WebCMSRoot.'Models/Content.php');
require_once($Config->WebCMSRoot.'Views/Content.php');

Class Content extends BaseControl
{
	var $content;
	var $view;
	
	function Content($parameters, &$page)
	{
		$this->content = new ContentModel();
		$this->view    = new ContentView();
		
		parent::BaseControl($parameters, &$page);
	}

	function Execute()
	{
//print('<pre>'.var_export($this, true).'</pre>');
//print('<pre>'.var_export($_GET, true).'</pre>');
		$this->content->Retrieve(&$this->parameters);
		
		switch (count($this->content->Collection))
		{
			case 1:
				$this->view->ShowContent(&$this->content->Collection[0]);
				break;
				
			case 0:
				$this->view->ShowContent(&$this->content);
				break;
		}
		
		parent::Execute();
	}

	function ValidateArguments()
	{
		$valid = count($this->parameters) >= 1;

		return $valid;
	}
}
?>